package com.xzy.generic.bad.example.e;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.core.ResolvableType;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 事件及其监听器管理
 *
 * @author xzy.xiao
 * @date 2023/3/6  13:59
 */
abstract class MyApplicationEventMulticaster implements ApplicationEventMulticaster {

    public final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<>();

    // ========== 监听器管理 ==========

    @Override
    public void addApplicationListener(ApplicationListener<?> listener) {
        this.applicationListeners.add(listener);
    }

    @Override
    public void removeApplicationListener(ApplicationListener<?> listener) {
        this.applicationListeners.remove(listener);
    }

    // ========== 事件管理 ==========

    @Override
    public void multicastEvent(ApplicationEvent event) {

    }

    @Override
    public void multicastEvent(ApplicationEvent event, ResolvableType eventType) {

    }
}
